public class ForTest2 {
    public static void main(String[] args) {
        //循环输出1-10的数字，统计1-10的累加和
        /*int sum = 0;
        for(int i=1; i<=10; i++){
            sum += i;
            System.out.println("i = " + i);
        }
        System.out.println("sum = " + sum);*/

        System.out.println("=================");
        //循环输出1-10的偶数，统计1-10的偶数累加和
        /*int sum = 0;
        for(int i=1; i<=10; i++){
            if(i%2==0) {
                sum += i;
                System.out.println("i = " + i);
            }
        }
        System.out.println("sum = " + sum);*/

        System.out.println("=================");
        //循环输出1-10的偶数，统计1-10的偶数累加和
        int sum = 0;
        for(int i=2; i<=10; i+=2){
            sum += i;
            System.out.println("i = " + i);
        }
        System.out.println("sum = " + sum);

    }
}
